#include "../include/StringMatch.h"
#include "../include/ArrayOps.h"
#include "../include/SparseMatrix.h"
#include "../include/CharCounter.h"
#include "../include/MatrixMultiplier.h"

void showMainMenu() {
    cout << "\n==========================================" << endl;
    cout << "        数据结构第四/五章上机 - 主菜单" << endl;
    cout << "==========================================" << endl;
    cout << "1. 字符串匹配算法测试" << endl;
    cout << "2. 数组操作测试" << endl;
    cout << "3. 稀疏矩阵测试" << endl;
    cout << "4. 字符统计测试" << endl;
    cout << "5. 稀疏矩阵乘法测试" << endl;
    cout << "6. 运行所有默认测试" << endl;
    cout << "0. 退出程序" << endl;
    cout << "==========================================" << endl;
}

int main() {
    cout << "数据结构课程设计 - 综合程序" << endl;
    
    while (true) {
        showMainMenu();
        int choice = Utils::getIntInput("请选择功能 (0-6): ");
        
        switch (choice) {
            case 1:
                StringMatch::interactiveTest();
                break;
            case 2:
                Array<int>::interactiveTest();
                break;
            case 3:
                SparseMatrixCross::interactiveTest();
                break;
            case 4:
                CharCounter::interactiveTest();
                break;
            case 5:
                MatrixMultiplier::interactiveTest();
                break;
            case 6:
                cout << "\n=== 运行所有默认测试 ===" << endl;
                StringMatch::testStringMatching();
                Array<int>::testArray();
                SparseMatrixCross::testSparseMatrix();
                CharCounter::testCharCounter();
                MatrixMultiplier::testMatrixMultiplication();
                break;
            case 0:
                cout << "上机结束!" << endl;
                return 0;
            default:
                cout << "无效选择，请重新输入！" << endl;
        }
    }
    
    return 0;
}